﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Linq.Expressions;
using TPA.DataAccess;

namespace TVProgramAnalyst.TimeLine
{
    public partial class ValuePickForm : Form
    {
        public ValuePickForm(string property)
        {
            InitializeComponent();

            lblProperty.Text = property+": ";

            Expression<Func<ProgramDisplayer, string>> ex = LambdaExpressionHelper.SelectExpression(property);


            //var r = BLLFactory.ProgramBLL.GetPrograms().Select(ex).Distinct();
            //foreach (var t in r)
            //{
            //    if (t != null&&t.Trim()!="")
            //    {
            //        cmbValues.Items.Add(t);
            //    }
            //}

            //if (cmbValues.Items.Count > 0)
            //{
            //    cmbValues.SelectedItem = cmbValues.Items[0];
            //}
        }

        public string SelectedValue
        {
            get;
            set;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void cmbValues_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.SelectedValue = cmbValues.SelectedItem.ToString();
        }

        private void ValuePickForm_Load(object sender, EventArgs e)
        {

        }
    }
}
